#include <sys/wait.h>
#include <sys/types.h>
#include <iostream>
int main()
{
    pid_t id = fork();
    if(id == 0)
    {
        int a = 1/0;
    }
    int status = 0;
    waitpid(id, &status, 0);//等待指定进程退出
    printf("I am the father process, child process: ");
    printf("exit code:%d", (status >> 8) & 0xff);
    printf("core dump:%d", (status >> 7) & 0x1);
    printf("signal:%d", status & 0x7f);
    return 0;
}